package com.ruipeng.shengyapo.locksocket;

import javax.servlet.ServletContext;

public class LockSocketThread extends Thread {

	private LockServer lockServer;
	private ServletContext servletContext;

	public LockSocketThread(ServletContext servletContext) {

		this.servletContext = servletContext;
		lockServer = new LockServer();

	}

	@Override
	public void run() {
		try {
			String port = this.servletContext.getInitParameter("socketPort");
			lockServer.bind(Integer.parseInt(port));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
